package framework.async
{
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;

	public class HandleResponder implements IResponder
	{
		public var resultHandler:Function;

		public var faultHandler:Function;

		public function HandleResponder()
		{
		}

		public function result(data:Object):void
		{
			var e:ResultEvent = ResultEvent(data);
			resultHandler(e);
		}

		public function fault(info:Object):void
		{
			var e:FaultEvent = FaultEvent(info);
			if (faultHandler != null)
			{
				faultHandler(e);
			}
			else
			{
				trace("handle fault: " + info);
			}
		}

	}
}